sap.ui.define([
    'sap/ui/core/UIComponent',
    "sap/m/bbf41/Module/model/models"
], function (UIComponent, models) {
    "use strict";
    return UIComponent.extend("sap.m.bbf41.Module.Component", {
        metadata: {
            rootView: "sap.m.bbf41.Module.view.App",
            dependencies: {
                libs: [
                    "sap.ui.table",
                    "sap.ui.unified",
                    "sap.m"
                ]
            },
            includes: ["style.css"],
            routing: {
                config: {
                    routerClass: "sap.m.routing.Router",
                    viewType: "XML",
                    viewPath: "sap.m.bbf41.Module.view",
                    controlId: "app",
                    controlAggregation: "pages",
                    bypassed: {
                        target: [
                            "rtb2"
                        ]
                    },
                    async: true
                },
                routes: [
                    {
                        pattern: "rtb2",
                        name: "RTB2",
                        target: [
                            "rtb2"
                        ]
                    },
                    {
                        pattern: "casting",
                        name: "casting",
                        target: [
                            "casting"
                        ]
                    }
                ],
                targets: {
                    rtb2: {
                        viewName: "RTB2",
                        viewId: "rtb2"
                    },
                    casting: {
                        viewName: "Casting",
                        viewId: "casting"
                    }
                }
            }
        },

        /**
         * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
         * In this function, the device models are set and the router is initialized.
         * @public
         * @override
         */
        init: function () {
            // call the base component's init function
            UIComponent.prototype.init.apply(this, arguments);

            // set the device model
            this.setModel(models.createDeviceModel(), "device");

            // create the views based on the url/hash
            this.getRouter().initialize();
        }
    });
});
